"""
@author: ztt
@file: accode.py
@time: 2022/11/24 21:19
"""
# 作业2、根据用户输入，生成N个由大写字母和数字组成的32位激活码
import random
import string

def accode(N):
        for i in range(N):
            code = random.sample(string.ascii_uppercase+string.digits,32)
            print(''.join(code))
            with open('code.txt','a') as fp:
                fp.write(''.join(code) + '\n')
        else:
            print("输入不合法！")
